package com.devops.admin.model;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import com.devops.admin.config.JSONTypeHandlerPg;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 
 * @TableName ip_address
 */
@TableName(value ="ip_address")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class IpAddress implements Serializable {
    /**
     * ip
     */
    @TableId
    private String ip;

    /**
     * ip地址数据
     */
    @TableField(typeHandler = JSONTypeHandlerPg.class)
    private Object ipData;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public JSONObject getIpData() {
        return JSONUtil.toBean(ipData.toString(), JSONObject.class);
    }
}